<div class="vheader">
    <h1><?php echo $this->translate("Client information") ?></h1>
    <p><?php echo $this->Clients->d->FullName ?>
</div>

<div class="vcontent">

    <img class="shadow" src="/default/photo/full/cat/i/id/<?php echo $this->Clients->d->ClientId ?>" />

    <div class="cell">
        <dl>
            <dt><?php echo $this->translate("Name") ?></dt>
            <dd><?php echo $this->Clients->d->FullName ?><br /><?php echo $this->Clients->d->NickName ?></dd>
            <dt><?php echo $this->translate("Status") ?></dt>
            <dd><?php echo $this->replaceEmpty($this->Clients->d->OfficerUsername,$this->translate("Inactive"),$this->translate("Active")) ?></dd>
            <dt><?php echo $this->translate("Group") ?></dt>
            <dd><?php echo $this->replaceEmpty($this->Clients->d->GroupId, 
                    $this->Clients->d->OfficerUserId ? $this->translate("Individual") : '-', 
                    $this->link('/admin/group/view', array('id'=>$this->Clients->d->GroupId),$this->Clients->d->GroupName) ) ?></dd>
            <?php if($this->Clients->d->GroupId): ?>
            <dt><?php echo $this->replaceEmpty($this->Clients->d->GroupId,'',$this->translate("Group code")) ?></dt>
            <dd><?php echo $this->Clients->d->GroupId ? $this->Clients->d->GroupId : '' ?></dd>
            <?php endif ?>
            <dt><?php echo $this->translate("Branch") ?></dt>
            <dd><?php echo $this->link('/admin/location/view',array('id'=>$this->Clients->d->LocationId),$this->Clients->d->Location) ?></dd>
            <dt><?php echo $this->translate("Loan officer") ?></dt>
            <dd><?php echo $this->link('/admin/officer/view',array('id'=>$this->Clients->d->OfficerUserId),$this->Clients->d->OfficerFullName) ?></dd>
            <dt><?php echo $this->translate("Country") ?></dt>
            <dd><?php echo $this->Clients->d->Country ?></dd>
            <dt><?php echo $this->translate("Identity number") ?></dt>
            <dd><?php echo $this->Clients->d->Code ?></dd>
            <dt><?php echo $this->translate("Identity type") ?></dt>
            <dd><?php echo $this->Clients->d->CodeType ?></dd>
            <dt><?php echo $this->translate("Email") ?></dt>
            <dd><?php echo $this->Clients->d->Email ?></dd>
            <dt><?php echo $this->translate("Home phone") ?></dt>
            <dd><?php echo $this->Clients->d->HomePhone ?></dd>
            <dt><?php echo $this->translate("Mobile") ?></dt>
            <dd><?php echo $this->Clients->d->MobilePhone ?></dd>
            <dt><?php echo $this->translate("Address") ?></dt>
            <dd><?php echo $this->Clients->d->HomeAddress ?></dd>
        </dl>
    </div>
            
            
    <div class="cell dd160">
        <dl>
            <dt><?php echo $this->translate("Birthdate") ?></dt>
            <dd><?php echo $this->Clients->d->Birthdate ?></dd>
            <dt><?php echo $this->translate("Gender") ?></dt>
            <dd><?php echo $this->Clients->d->Gender ?></dd>
            <dt><?php echo $this->translate("Marital status") ?></dt>
            <dd><?php echo $this->Clients->d->MaritalStatus ?></dd>
            <dt><?php echo $this->translate("Spouse name") ?></dt>
            <dd><?php echo $this->Clients->d->SpouseName ?></dd>
            <dt><?php echo $this->translate("Children") ?></dt>
            <dd><?php echo (int) $this->Clients->d->Children ?></dd>
            <dt><?php echo $this->translate("Dependents") ?></dt>
            <dd><?php echo (int) $this->Clients->d->Dependents ?></dd>
            <dt><?php echo $this->translate("Education") ?></dt>
            <dd><?php echo $this->Clients->d->Education ?></dd>
            <dt><?php echo $this->translate("Handicap") ?></dt>
            <dd><?php echo $this->Clients->d->Handicap ?></dd>
            <dt><?php echo $this->translate("Skills") ?></dt>
            <dd><?php echo $this->Clients->d->Skills ?></dd>
            <dt><?php echo $this->translate("Businesses") ?></dt>
            <dd>
                <?php foreach($this->Clients->r->businesses as $business) 
                    echo ' ' . $this->link('/admin/business/view',array('id'=>$business->BusinessId),$business->Name) . '&nbsp;' ?>
                <?php if(count($this->Clients->r->businesses) > 0) 
                    echo $this->link('/admin/business/add', array('client'=>$this->Clients->d->ClientId),$this->translate("Add new business"))?>
            </dd>
            <dt><?php echo $this->translate("Community") ?></dt>
            <dd><?php echo $this->Clients->d->Community ?></dd>
            <dt><?php echo $this->translate("Type") ?></dt>
            <dd><?php echo $this->Clients->d->CommunityType ?></dd>
            <dt><?php echo $this->translate("Comments") ?></dt>
            <dd><?php echo $this->Clients->d->Comments ?></dd>
        </dl>
    </div>

    <div class="cell">
        <dl>
            <dt></dt>
            <dd><b><?php echo $this->translate("Savings") ?></b></dd>
            <dt><?php echo $this->translate("Savings type") ?></dt>
            <dd><?php echo $this->Clients->d->SavingsProductName ?></dd>
            <dt><?php echo $this->translate("Savings balance") ?></dt>
            <dd><?php echo $this->Savings->Balance ?></dd>
            <dt></dt>
            <dd><b><?php echo $this->translate("Last transaction") ?></b></dd>
            <dt><?php echo $this->translate("Date") ?></dt>
            <dd><?php echo $this->Savings->LastTransactionDate ?></dd>
            <dt><?php echo $this->translate("Amount") ?></dt>
            <dd><?php echo $this->Savings->LastTransactionAmount ?></dd>
            <dt><?php echo $this->translate("Type") ?></dt>
            <dd><?php echo $this->Savings->LastTransactionType ?></dd>
            <dt><?php echo $this->translate("Registered by") ?></dt>
            <dd><?php echo $this->Savings->LastTransactionUserFullName ?></dd>
        </dl>    
    </div>

</div>   

<!--
<div class="vgrid">
    <?php //echo $this->partial('partials/grid.phtml', $this->Clients->r->loans); ?>
</div>
-->



<div class="vfooter">
    <div class="menu">
        <?php echo $this->link('/admin/client/add', array('id'=>$this->Clients->d->ClientId),$this->translate("Edit client")) ?>
        <?php echo $this->link('/admin/bank/add', array('id'=>$this->Clients->d->BankId,'client'=>$this->Clients->d->ClientId,'group'=>$this->Clients->d->GroupId),$this->translate("Edit bank")) ?>
        <?php if(count($this->Clients->r->businesses) == 0) echo $this->link('/admin/business/add', array('client'=>$this->Clients->d->ClientId),$this->translate("Add business")) ?> 
        <?php echo $this->Clients->d->StoryId ? 
            $this->link('/admin/story/view', array('id'=>$this->Clients->d->StoryId),$this->translate("View story")) :
            $this->link('/admin/story/add', array('client'=>$this->Clients->d->ClientId),$this->translate("Add story")) ?>      
        <?php echo $this->link('/survey/survey-completed/browse', array('ClientId'=>$this->Clients->d->ClientId),$this->translate("Surveys"),array('target'=>'bottom')) ?> 
        <?php echo $this->link('/loan/loan/browse', array('ClientId'=>$this->Clients->d->ClientId),$this->translate("Loans"),array('target'=>'bottom')) ?>  
        <?php echo $this->link('/loan/application/new', array('client'=>$this->Clients->d->ClientId),$this->translate("Request new loan")) ?> 
        
        <?php //echo $this->link('/savings/savings-account/view', array('id'=>$this->Clients->d->ClientId),$this->translate("Savings")) ?>  
        <?php echo $this->link('/savings/savings-transaction/browse', array('ClientId'=>$this->Clients->d->ClientId,'ClientFirstName'=>$this->Clients->d->FirstName),$this->translate("Savings transactions"),array('target'=>'bottom')) ?>  
        <?php echo $this->link('/savings/savings-deposit/add', array('client'=>$this->Clients->d->ClientId),$this->translate("Make deposit")) ?>  
        <?php echo $this->link('/savings/savings-withdrawal/add', array('client'=>$this->Clients->d->ClientId),$this->translate("Make withdrawal")) ?>  
        
        <?php echo $this->link('/admin/client/map', array('id'=>$this->Clients->d->ClientId),$this->translate("Map")) ?>
    </div>
</div>